Skip to content

load prefetch: the allocation-failure test refuses resizes, so it passes at any checkout path length - #5772

Merged
ashhart merged 2 commits into
ashhart:mainfrom
Bizuayeu:pr/load-prefetch-resize
Dec 1, 2026
Merged

ashhart merged 2 commits into
ashhart:mainfrom
Bizuayeu:pr/load-prefetch-resize

Conversation

@Bizuayeu

@Bizuayeu Bizuayeu commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

On a GB10 (aarch64), test-load-prefetch-host from worktrees of the same commit at different absolute path lengths, a fresh --cache-dir each run so the test runs:

Absolute checkout path main 20ddd967cf this head
24 characters 0 of 3 pass (NondeterministicMemoryUsage) 3 of 3 pass
40 characters 3 of 3 pass 3 of 3 pass

What this changes

load_prefetch_host's "every family balances allocation failures while readers may be live" passes or fails by the length of the checkout's absolute path, with NondeterministicMemoryUsage from checkAllAllocationFailures. The fixture's directory is a real path under the checkout's .zig-cache/tmp, and the readers allocate from it inside the check. The test now hands that check a FailingAllocator that refuses resizes, as exl3_load's test has since #2377 (#2413 was the same failure there). Only the test changes.

  • Found while taking receipts on main af2d9b2ce0: the test failed from a 25-character worktree and passed from longer ones. On main 20ddd967cf, from one worktree moved to each length, two runs each: 24 characters failed both times; 32, 40, 48, 56, 64 and 72 passed both times; pinned to 6 cores, 24 still failed and 72 still passed, so it follows the path, not the thread count.
  • Issue: n/a. No open issue or pull request covers this test (searched for "load_prefetch", "load prefetch" and "NondeterministicMemoryUsage" on 2026-12-01).
  • Stacked on: main (20ddd967cf); one commit: 1 file changed, 3 insertions(+), 1 deletion(-). It merges with main (eb89ebb451) cleanly; zig/load_prefetch_host.zig has not changed on main since.
  • atc overlap --json: atc 0.9.4 with ATC_READ_ONLY=1, run in this tree on 2026-11-30 at 23:54 UTC with --base 20ddd967cf: complete: false (otherPullRequestsLimit, pullFilesUnavailable, pullRequestsLimit, timeLimit), no pull request in its working tree's rows. By git merge-tree against each of the 355 open pull requests' heads, this head adds a conflict to none.

Checks on this head

  • Head commit: 83612d38c6 load prefetch: the allocation-failure test refuses resizes, so it passes at any checkout path length.
  • Lean checker, tools/zig/lean_check.py on the base and on this head (through tools/pr_check.py --base 20ddd967cf): 88 problems on both, 0 new; import cycle edges 25 against 25, 0 new; cross-family edges 11 against 11 (1 allowed); 0 errors. No CHANGELOG line, as on other recent pull requests.
  • Tests run, with the command and pass, fail and skip counts (Zig 0.17.0):
    • GB10 (aarch64): the table above (zig build --cache-dir ... -Dfixed-cpu test-load-prefetch-host --summary all, base and head alternating); zig build -Dfixed-cpu test-cuda-host on this head, 588 of 588 steps, 10,982 of 11,034 tests passed, 52 skipped, 0 failed.
    • WSL 2 (x86-64): a fresh clone of this head at an 18-character path and main in a worktree of the same length: test-load-prefetch-host 3 of 3 pass on both (the failure doesn't show on x86-64 at this length); git diff --check clean; zig build -Dfixed-cpu test-cuda-host on this head, 588 of 588 steps, 10,982 of 11,034 tests passed, 52 skipped, 0 failed.
    • Windows: zig fmt --check and zig ast-check on the changed file, git diff --check, clean; test-load-prefetch-host 3 of 3 steps, 12 of 12 tests passed (a 74-character path).
  • CI: every job passes or is skipped on this head: fmt, zig, pytest, benchmark-clients and comfyui-moss-installer pass (runs 46548394725, No GPU, and 46548394736, Zig format); the rest are skipped.
  • Not run, and why: macOS's host tests (the change is a host Zig test only, with no platform code).

Receipt

  • Main against branch: the table above.
  • Boxes it reaches: none served; only a host test changes.
  • New switch? None.
  • Environment, with the TensorFold commit, Zig and backend toolchain, machine and GPU, checkpoint and revision: 83612d38c6 on main 20ddd967cf; Zig 0.17.0; a GB10 (aarch64, 4 KiB pages), WSL 2 (x86-64) and Windows; no GPU and no checkpoint (the test writes its own small safetensors file).
  • Paths and platforms the change reaches, which I ran and which I could not: the host test on the GB10, WSL 2 and Windows; not macOS.
  • Exactness, from tools/bench_concurrent.py --alone --serial or token_sha against "draft": false: n/a (no served path).
  • Main against this branch, same machine and checkpoint, posted before asking for a run on our machines (or why you can't): the table above (no served path).
  • Decode speed before and after, from tools/bench_openai.py: n/a (no served path).
  • Prompt speed before and after: n/a (no served path).
  • Licence of any new weights or drafter, or "n/a": n/a.
  • Kernels registered with the contract, and the kernel each one replaces: none.
  • A planted control for each new kernel, and each one fails as planted: n/a (no new kernel). The changed test itself fails on main from a 24-character path, as in the table.
  • Each backend's SUMMARY line and exit status: n/a (no kernel contract run; host tests only).
  • Chips I could not run: none needed (no GPU code).

Checklist

  • The title and description match the head commit, including the receipt and the stack.
  • New tests fail before the change, pass after it, and skip cleanly without their dependency (no new test; the changed one fails on main from a 24-character path and passes there on this head).
  • Comments and docstrings are one line. No measurements or history in the source.
  • No personal data, machine names, internal hosts or local paths in the diff or its commits. No AI attribution lines.
  • Every token still goes through the lane rounds. No serial path, and nothing that needs drafts off (no served path changes).
  • Drafted output equals "draft": false, a resumed prompt equals a fresh one, and concurrent equals solo (no served path changes).
  • No precision traded for speed. If the bits change, the description says which sums change and why (no served bits change).
  • Decode and prompt processing are no slower than main at one stream and the widest admitted; with --drafter, no slower than without it, greedy and sampled (no served path changes).

@ashhart

ashhart commented Dec 1, 2026

Copy link
Copy Markdown
Owner

Thanks @Bizuayeu. This is a clear find with a clean fix that only touches the test. The table makes the case: from a 24-character checkout, main fails every run and this head passes every run.

What I checked at 83612d38c6:

  • Only the test changes (zig/load_prefetch_host.zig:155-157). No served file, switch or kernel moves.
  • With resizes refused, every growth becomes an alloc, a copy and a free. checkAllAllocationFailures then counts the same allocations on every run, however long the temporary path is. The test still fails each allocation in turn and checks that nothing leaks. Main already uses the same pattern elsewhere, for example zig/qwen35_modelopt_host.zig:55 and zig/tests/h3_image_server.zig:471.
  • It merges cleanly with current main and adds no lean problems.

One optional question, not blocking: do you know which reader's count moved with the path length? If it's another growing path join, like the one ad2169a34d sized up front in checkpoint_read_ahead.zig, a line about it in the commit message would help whoever looks next.

This is ready. It needs no device run, so we'll land it after our local CI passes.

  • Synthena

@ashhart

ashhart commented Dec 1, 2026

Copy link
Copy Markdown
Owner

READY to land on this head. Reviewed at this head: only the load-prefetch test changes (resizes refused, as main's other allocation-failure tests do); no served file or switch moves, and this head's CI passed. Thank you!

  • Synthena

@Bizuayeu

Bizuayeu commented Dec 1, 2026

Copy link
Copy Markdown
Contributor Author

do you know which reader's count moved with the path length?

(#5772 (comment))

MiniMax's, and this time it isn't a path join. On the GB10 at main 93a3172b5d, from a 24-character checkout, a local probe (not committed) that catches checkAllAllocationFailures per family reports NondeterministicMemoryUsage for minimax only; the other seven families pass, and all eight pass from 40 characters. MiniMax's adapter goes through core's checkpoint_prefetch.cut, which keeps each file's own path and ends with out.toOwnedSlice(gpa). With that one call replaced by an exact copy (gpa.dupe, then clearAndFree), minimax passes from 24 characters in 3 runs of 3. So it's toOwnedSlice's shrinking remap, which may or may not succeed in place, the same kind of dependence as the growing writer ad2169a34d removed.

I've left the commit as it is, so the head you marked ready stands. If you'd like cut to copy exactly as well, so its count no longer depends on the remap for any caller, I can open that as its own pull request.

@ashhart

ashhart commented Dec 1, 2026

Copy link
Copy Markdown
Owner

Thanks, @Bizuayeu, that's a clear trace: MiniMax's checkpoint_prefetch.cut and the shrinking remap in toOwnedSlice. Yes, please open the exact copy in cut as its own pull request. It removes the same kind of dependence for every caller, and this one can land as it is.

  • Synthena

@Bizuayeu

Bizuayeu commented Dec 1, 2026

Copy link
Copy Markdown
Contributor Author

Yes, please open the exact copy in cut as its own pull request.

(#5772 (comment))

Opened as #5828: cut returns gpa.dupe of its spans, then clearAndFree, in place of toOwnedSlice. On the GB10, main's load-prefetch test fails from a 24-character checkout in 3 runs of 3 and this head passes in 3 of 3; both pass from 40 characters, and in WSL 2 from 18.

Bizuayeu and others added 2 commits December 1, 2026 11:44
…ses at any checkout path length

"every family balances allocation failures while readers may be live" passed or failed by the checkout's absolute path
length, with NondeterministicMemoryUsage from checkAllAllocationFailures: the fixture's directory is a real path under
the checkout's .zig-cache/tmp, and the readers allocate from it inside the check. It now hands the check a
FailingAllocator that refuses resizes, as exl3_load's test has since ashhart#2377. Only the test changes.
@ashhart
ashhart force-pushed the pr/load-prefetch-resize branch from 83612d3 to c71449f Compare December 1, 2026 11:44
@ashhart
ashhart merged commit afdf4fc into ashhart:main Dec 1, 2026
4 of 9 checks passed
@ashhart

ashhart commented Dec 1, 2026

Copy link
Copy Markdown
Owner

Thank you @Bizuayeu. This is merged into main with your commits under your own name, so you're listed as a TensorFold contributor. It ships in the next release, credited to you in the changelog and the release notes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants